In a large computing enterprise, various departments typically employ different databases possibly with redundant schema information. The term "schema" as used herein shall mean definitional information that provides information about or documentation of other data stored within a database. The proliferation of databases within an enterprise makes it extremely difficult for database administrators to manage the data and provide correct schema information rapidly. Also, since departments have been managing their own database without interacting with each other, the integrity of the data could be lost. Moreover, since the databases do not support maintaining a history of the database schemas, it is difficult for administrators to restore to old versions and also efficiently create and manage schema. By storing and maintaining a history of database schemas in an object-oriented repository that supports versioning, those schemas can be better managed. Storing the database schemas in a repository helps with data warehousing and provides for easy access to meta information.
A database technology model, which employs an embodiment of the present invention, provides three functions: import, export and synchronize. Using the import and synchronize functions, a user can maintain in the repository a version history of a database schema. Also, a user can update the database schema with a repository version of the schema by exporting the differences between the two database schemas to a file in data definition language (DDL) format, and then use the DDL statements to make the changes in the database.
The import, export, and synchronize operations generate and store reports in the repository as instances of a log file. A user can view the reports by using the log file operations as follows:
Import: The import operation connects to the database, reads the catalog information and stores that information in the repository. Many types in the DB technology model have an import operation. When a user imports a composite object, the object is imported and, recursively, all the component objects it contains are imported. For example, in the case of a relational database when a database object is imported, tables and procedures are imported. Also, when the table object is imported, columns, indexes, keys, constraints and triggers are imported.
Export: The export operation sends requested schema data to a file in DDL format. Export sends only the differences between the database schema and the version of the schema in the repository. The DDL statements can be used to update the database schema. The export operation functions recursively in the same manner as the import operation.
Synchronize: The synchronize operation maintains histories of database schemas as they change. The synchronize operation compares objects in a database schema with the objects in the repository copy of the same schema. If the synchronize operation finds differences, the differences are copied to the repository and assigned the next higher version number. The synchronize operation invokes the versioning operation which versions all objects in a composite hierarchy up to the database object. The synchronize operation does not create variant branches in a version graph; it creates only mainline branches. The synchronize operation functions recursively in the same manner as the import and export operations.